﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

var timer = null;

jQuery(document).ready(function(){
	jQuery(".menutab > li").click(function(e){        
    //jQuery(".menutab > li").mouseover(function(e){  
		//switch(e.target.id){
        switch(jQuery('a', this).attr('id')){
			case "0":
				//change status & style menu
				$("#news_li").addClass("tab_current");
				$("#tutorials_li").removeClass("tab_current");
				$("#links_li").removeClass("tab_current");
				//display selected division, hide others
				$("#news_block").fadeIn(500);
				$("#tutorials_block").css("display", "none");
				$("#links_block").css("display", "none");
			break;
			case "1":
				//change status & style menu
				$("#news_li").removeClass("tab_current");
				$("#tutorials_li").addClass("tab_current");
				$("#links_li").removeClass("tab_current");
				//display selected division, hide others
				$("#tutorials_block").fadeIn(500);
				$("#news_block").css("display", "none");
				$("#links_block").css("display", "none");
			break;
			case "2":
				//change status & style menu
				$("#news_li").removeClass("tab_current");
				$("#tutorials_li").removeClass("tab_current");
				$("#links_li").addClass("tab_current");
				//display selected division, hide others
				$("#links_block").fadeIn(500);
				$("#news_block").css("display", "none");
				$("#tutorials_block").css("display", "none");
			break;
		}
        //$("#default_block").css("display", "none");        
        $("#default_block").css("visibility", "hidden");        
        
		//alert(e.target.id);
        if(timer != null){
            clearTimeout(timer);
        }
        timer = setTimeout("releaseItem()", 15000);
		return false;
	});
    
    /*
    jQuery(".menutab > li").mouseleave(function(e){      
        $("#news_li").removeClass("tab_current");
        $("#tutorials_li").removeClass("tab_current");
        $("#links_li").removeClass("tab_current");

        $("#news_block").css("display", "none");
        $("#tutorials_block").css("display", "none");
        $("#links_block").css("display", "none");        
        
        $("#default_block").fadeIn(200);            
        
        return false;
    });
    */
});

function releaseItem(){      
    $("#news_li").removeClass("tab_current");
    $("#tutorials_li").removeClass("tab_current");
    $("#links_li").removeClass("tab_current");

    $("#news_block").css("display", "none");
    $("#tutorials_block").css("display", "none");
    $("#links_block").css("display", "none");        
    
    //$("#default_block").fadeIn(200);   
    $("#default_block").css("visibility", "visible");                 
    
    return false;
};